<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="${root}/resources/css/pintuer.css">
<link rel="stylesheet" href="${root}/resources/css/admin.css">
<script src="${root}/resources/js/jquery.js"></script>
<script src="${root}/resources/js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>
  <div class="padding border-bottom">
    <button type="button" class="button border-yellow" onclick="window.location.href='${root}/admin/role/toAdd'"><span class="icon-plus-square-o"></span> 添加角色</button>
  </div>
  <table class="table table-hover text-center">
    <tr>
      <th width="5%">ID</th>
      <th width="15%">角色名</th>
      <th width="10%">角色描述</th>
      <th width="10%">操作</th>
    </tr>
    <c:forEach items="${roles}" var="role" varStatus="vs">
      <tr>
        <td>${vs.count}</td>
        <td>${role.rolename}</td>
        <td>${role.roledesc}</td>
        <td><div class="button-group">
          <a class="button border-main" href="${root}/admin/role/toUpdate?id=${role.id}"><span class="icon-edit"></span> 编辑</a>
          <a class="button border-red" href="javascript:void(0)" onclick="return del(${role.id})"><span class="icon-trash-o"></span> 删除</a>
        </div></td>
      </tr>
    </c:forEach>
  </table>
</div>
<script type="text/javascript">
function del(id) {
    if (confirm("您确定要删除吗?")) {
        location.href="${root}/admin/role/delete?roleId="+id;
    }
}
</script>
</body>
</html>